<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="//libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
    <script src="./herryPostMessage.js"></script>
  </head>
  <body>
    <iframe
      src="//localhost:8081/2.html"
      id="ifr"
      frameborder="0"
    ></iframe>
    <button onclick="a1()">1</button>
    <script>
      herry.iframeId = "ifr";
      function a1() {
        herry.postMessage({ action:'geta1', x: 1 }, (res) => {
          console.log(res.data);
        });
        herry.postMessage({ action:'geta2', x: 2 }, (res) => {
          console.log(res.data);
        });
      }
    </script>
  </body>
</html>
